import { createRouter, createWebHistory } from 'vue-router'
import Index from '../pages/Index.vue'



const routes = createRouter({
    history: createWebHistory(),
    routes: [{
            // name: 'home',
            path: '/',
            redirect: '/index',
            component: Index,
            meta: { title: '首页' },

            children: [

                {
                    path: '/index',
                    name: 'index',
                    component: () =>
                        import ('../pages/subpages/index.vue'),
                    meta: {
                        title: '首页'
                    }


                },

                {
                    path: '/category',
                    name: 'category',
                    component: () =>
                        import ('../pages/subpages/Category.vue'),
                    meta: {
                        title: '分类管理'
                    }


                },

                {
                    path: '/good',
                    name: 'good',
                    component: () =>
                        import ('../pages/subpages/Good.vue'),
                    meta: {
                        title: '商品管理'
                    }


                },
            ]
        },
        {
            path: '/login',
            name: 'login',
            component: () =>
                import ('../pages/Login.vue'),
            meta: {
                title: '登录'
            }

        }
    ]
})
export default routes